import QtQuick 2.0
import QtQuick.Controls 2.3
import QtQuick.Controls.impl 2.12

Item {
    id:root
    width: 80
    height: width*0.4

    property alias nameText: name.text
    property real nameFontpixelSize: height/2
    property bool mIsClickable: $sqlMcRecorder.qml_getOperaterMode()>=90

    signal clicked()

    Timer{
        interval: 500
        repeat: true
        triggeredOnStart: false
        running: true
        property int mdate: 0
        onTriggered: mIsClickable = $sqlMcRecorder.qml_getOperaterMode()>=90
    }

    ItemDelegate {
        id:exc_normal_btnstyle
        anchors.fill: parent
        clip: true
        font.weight: Font.Black
        checkable: false
        scale: (mIsClickable && hovered)?(pressed? 0.96:0.98):1

        contentItem: Text {
            id: name
            color: mIsClickable?"white":"#AAAAAA"
            text: qsTr("BTN")
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.verticalCenter: parent.verticalCenter
            font.bold: true
            font.family: "宋体"
            font.pixelSize: nameFontpixelSize
            horizontalAlignment: Text.AlignHCenter//(1)
            verticalAlignment: Text.AlignVCenter//(2)
        }

        background:Image {
            source:mIsClickable?(!exc_normal_btnstyle.pressed?(exc_normal_btnstyle.hovered? "../picture/button/buttonStyle2_hover.png":
                                       "../picture/button/buttonStyle2.png"):
                                         "../picture/button/buttonStyle2_checked.png"):
                               "../picture/button/buttonStyle2_disable.png"
        }

        onClicked: if(mIsClickable) btnWindows.show();
    }

    EXC_BtnWindows{
        id: btnWindows
        funcStr: nameText
        onMAccept: clicked()
    }
}


/*##^##
Designer {
    D{i:0;formeditorZoom:4}
}
##^##*/
